package com.zang.netty.io.nio;

import com.zang.netty.io.model.enums.SocketEnum;

/**
 * TimeServer 时间服务器
 * @author Zhang Qiang
 * @Date 2019/7/18 18:57
 */
public class TimeServerByNio {

    public static void main(String[] args) {
        int port = SocketEnum.NIO_PORT.getNum();
        if (args!=null && args.length>0){
            try {
                port = Integer.valueOf(args[0]);
            }catch (NumberFormatException e){
                //如果传参则用传参做port，不传参则使用默认port
            }
        }
        MultiplexerTimeServer timeServer = new MultiplexerTimeServer(port);
        //开启线程
        new Thread(timeServer, "NIO-MultiplexerTimeServer-001").start();

    }

}
